<template>
	<view class="u-page">
		<u-sticky>
			<view class="search">
				<u-search placeholder="公司名称"
				v-model="company" border-color="#2979ff" @search="search()" @custom="search()"
				:action-style="{'background-image': 'linear-gradient(45deg, #1cbbb4, #0081ff)','color': '#ffffff','height': '64rpx',
				'line-height': '64rpx','border-radius': '10rpx','width':'120rpx'}"	
				></u-search>
			</view>
		</u-sticky>
		<view class="cu-list menu-avatar">
			<view class="cu-item" style="padding-right: 0rpx;" v-for="i in info" :key="i.id">
				<view style="left: 20rpx;width: calc(100% - 40rpx - 120rpx);line-height: 1.6em;">
					<view class="text-grey text-cut">{{i.name}}</view>
					<view class="text-gray text-sm flex">
						<view class="text-cut">
							{{i.credit_no}}
						</view> 
					</view>
				</view>
				<view class="action" style="width: 140rpx;">
					<button class="cu-btn bg-gradual-red text-white" style="width: 120rpx;" @click="change_to(i)">变更</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				company:'',
				info: [
				    
				]
			}
		},
		methods:{
			change_to(row){
				uni.navigateTo({
				    url:"../change/change?id="+row.id+"&name="+row.name+"&status="+row.status+"&oper_name="
					+row.oper_name+"&companyCode="+row.credit_no
				});
			},
			search(v){
				uni.navigateTo({
				    url:"../change/change?id=1&name=test&status=xx&oper_name=xxx&companyCode=xxx"
				});
				
				/* if(this.company.length<4){
					uni.showToast({
					    title: '公司名称过短',
						icon:'none',
					    duration: 1000
					});
					return
				}
				uni.showLoading({
				    title: '搜索中...'
				});
				this.$H.post("/homeapi/search",{keywords:this.company},{}).then(res=>{
					uni.hideLoading();
					if(res.data!=null){
						this.info=res.data;
					}
					if(this.info.length===0){
						uni.showToast({
						    title: '无匹配数据',
							icon:'none',
						    duration: 1000
						});
					}
				}).catch(err=>{
					uni.hideLoading();
					uni.showToast({
					    title: '搜索失败',
						icon:'none',
					    duration: 1000
					});
				}) */
			}
		}
	}
</script>

<style>
	.search{
		padding: 10rpx;
		background-color: #FFFFFF;
	}
</style>
